const mongoose = require('mongoose');

const userSchema = new mongoose.Schema({
  openid: {
    type: String,
    required: true,
    unique: true
  },
  nickname: String,
  sex: Number,
  province: String,
  city: String,
  country: String,
  headimgurl: String,
  privilege: [String],
  unionid: String,
  subscribe: {
    type: Boolean,
    default: false
  },
  subscribe_time: Date,
  subscribe_scene: String,
  qr_scene: Number,
  qr_scene_str: String,
  language: String,
  remark: String,
  groupid: Number,
  tagid_list: [Number]
}, {
  timestamps: true
});

module.exports = mongoose.model('User', userSchema);        